package Evaluation;

import java.util.*;
import java.io.*;

public class TestCaseDivide {
	/*two list store the failure and sucess test case index*/
	List<Integer> failure;
	List<Integer> sucess;
	
	public TestCaseDivide(){
		failure = new ArrayList<Integer>();
		sucess = new ArrayList<Integer>(); 
		
	}
	
	/*read the bug hit file and fill the two list*/
	public void divideFailureSucess(String bugHitFile){
		try {
			BufferedReader br = new BufferedReader(new FileReader(bugHitFile));
			int testCaseIndex = 0;
			String readLine = br.readLine();
			
			while(readLine != null){
				if(readLine.contains("1"))
					failure.add(testCaseIndex);
				else
					sucess.add(testCaseIndex);
				testCaseIndex++;
				readLine = br.readLine();
			}
			br.close();
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException ioe) {
			ioe.printStackTrace();
		} 
		
	}
	
	public ArrayList<Integer> getFailureIndexCluster(){
		return (ArrayList<Integer>) failure;
	}
	
	public ArrayList<Integer> getSucessIndexCluster(){
		return (ArrayList<Integer>) sucess;
	}
	
	
	
}
